package gui;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

/**
 * Handles the mouse-input for the GUI.
 * @author nick-luca.frank
 *
 */
public class GUImouseListener implements MouseListener, MouseMotionListener{
	private boolean left;
	private boolean right;
	private boolean pressed;
	private int posX, posY;
	private int x, y;
	
	@Override
	public void mouseMoved(MouseEvent e){
		x = e.getX();
		y = e.getY();
	}
	
	@Override
	public void mouseClicked(MouseEvent e) {

	}

	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub
	}

	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
	}

	@Override
	public void mousePressed(MouseEvent e) {
		if(e.getButton() == 1){
			left = true;
		}else if(e.getButton() == 3){
			right = true;
		}
		posX = e.getX();
		posY = e.getY();
		
		pressed = true;
	}

	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
	}
	
	public boolean getLeftButtonState(){
		if(left){
			left = false;
			return true;
		}else{
			return false;
		}
	}
	
	public boolean getRightButtonState(){
		if(right){
			right = false;
			return true;
		}else{
			return false;
		}
	}
	
	public boolean getButtonPress(){
		if(pressed){
			pressed = false;
			return true;
		}else{
			return false;
		}
	}
	
	public int getClickX(){
		return posX;
	}
	
	public int getClickY(){
		return posY;
	}
	
	public int getX(){
		return x;
	}
	
	public int getY(){
		return y;
	}

	@Override
	public void mouseDragged(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}
}